Use simpler mode for open() on Windows. (No S_I?GRP and S_I?OTH bits are
authorTor Lillqvist <tml@novell.com>
Tue, 27 May 2008 13:03:49 +0000 (13:03 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Tue, 27 May 2008 13:03:49 +0000 (13:03 +0000)
2008-05-27  Tor Lillqvist  <tml@novell.com>

* gtk/updateiconcache.c (build_cache): Use simpler mode for open()
on Windows. (No S_I?GRP and S_I?OTH bits are defined in
<sys/stat.h> on Windows, and the mode used in open() doesn't
matter much as there are no rwxrwxrwx bits on Windows anyway.)
Open file in binary mode. Passing "b" to fdopen() later isn't
enough.

svn path=/trunk/; revision=20190

ChangeLog
gtk/updateiconcache.c

index d2beae749c09db966abddfcf8428269df2af208d..9957e34da80ab07b68e296b171d7b611e7b9b65f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-05-27  Tor Lillqvist  <tml@novell.com>
+
+       * gtk/updateiconcache.c (build_cache): Use simpler mode for open()
+       on Windows. (No S_I?GRP and S_I?OTH bits are defined in
+       <sys/stat.h> on Windows, and the mode used in open() doesn't
+       matter much as there are no rwxrwxrwx bits on Windows anyway.)
+       Open file in binary mode. Passing "b" to fdopen() later isn't
+       enough.
+
 2008-05-27 10:33:41  Tim Janik  <timj@imendio.com>
 
        * gtk/gtkwidget.c: guard gtk_widget_get_snapshot() against
index 1f748fa6a149eec50feb7652c9a011096e3a151d..15fc7ca80af1fafcdf736d9ace79666b12576ae4 100644 (file)
@@ -1437,11 +1437,18 @@ build_cache (const gchar *path)
   struct utimbuf utime_buf;
   GList *directories = NULL;
   int fd;
+#ifndef G_OS_WIN32
   mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
-  
+#else
+  int mode = _S_IWRITE | _S_IREAD;
+#endif
+#ifndef _O_BINARY
+#define _O_BINARY 0
+#endif
+
   tmp_cache_path = g_build_filename (path, "."CACHE_NAME, NULL);
 
-  if ((fd = open (tmp_cache_path, O_WRONLY | O_CREAT | O_EXCL | O_TRUNC, mode)) == -1)
+  if ((fd = open (tmp_cache_path, O_WRONLY | O_CREAT | O_EXCL | O_TRUNC | _O_BINARY, mode)) == -1)
     {
       g_printerr (_("Failed to open file %s : %s\n"), tmp_cache_path, g_strerror (errno));
       exit (1);